package com.aosan.website.auth.controller

import com.aosan.website.auth.service.AuthService
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Value
import org.springframework.web.bind.annotation.DeleteMapping
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import javax.servlet.http.HttpServletRequest

@RestController
@RequestMapping("/")
class AuthController(
        val request: HttpServletRequest,
        val authService: AuthService
) {

    val logger = LoggerFactory.getLogger(this::class.java)

    @Value("\${security.oauth2.client.access-token-uri}")
    val tokenUrl: String = ""


    @PostMapping("/login")
    fun browserLogin(username: String, password: String, type: String): Any? {
        return authService.fetchLoginToken(username, password)
    }

    /**
     * 登出
     */
    @DeleteMapping("/logout")
    fun logout() {

    }


}